package o;

import android.content.Intent;
import android.view.KeyEvent;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import java.util.LinkedHashMap;
import o.dys.a;

public abstract class dyr {
    public static final String BI_KEY_ACTION = "Action";
    public static final String BI_KEY_CALLER = "callerPackage";
    public static final String BI_KEY_URL = "URL";
    public static final String EVENT_ID_THIRD_API_ENTRANCE = "330301";
    public static final int KEY_DOWN_RESULT_HANDLE_FALSE = 0;
    public static final int KEY_DOWN_RESULT_HANDLE_TRUE = 1;
    public static final int KEY_DOWN_RESULT_IGNORE = -1;
    public static final int RESULTCODE_AGREE_PROTOCOL = 1001;
    public static final int RESULTCODE_NOT_AGREE_PROTOCOL = 1002;
    private static final String TAG = "IExternalAction";
    private String actionName = "";
    public a callback;

    public abstract void onAction();

    public dyr(a aVar) {
        this.callback = aVar;
    }

    public boolean useCacheProtocol() {
        return false;
    }

    public boolean isNeedLoading() {
        return false;
    }

    public long getTimeout() {
        return -1;
    }

    public void doAction() {
        onThirdEntranceReport();
        onAction();
    }

    protected void onThirdEntranceReport() {
        cdk.ॱ(EVENT_ID_THIRD_API_ENTRANCE, getReportMap());
    }

    public void setActionName(String str) {
        this.actionName = str;
    }

    public String getActionName() {
        return this.actionName;
    }

    protected LinkedHashMap<String, String> getReportMap() {
        LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap();
        if (this.callback != null) {
            linkedHashMap.put(BI_KEY_ACTION, getActionName());
            String ˊ = cgt.ˊ(this.callback.ˊ());
            Logger.ˎ(TAG, "caller package: " + ˊ);
            String packageName = ContentManager.getInstant().getContext().getPackageName();
            if (!(ˊ == null || ˊ.equals(packageName))) {
                linkedHashMap.put(BI_KEY_CALLER, ˊ);
            }
        }
        return linkedHashMap;
    }

    public void onDestroy() {
    }

    public boolean onTimeout() {
        return false;
    }

    public void cancelTask() {
    }

    public void onPause() {
    }

    public void onActivityResult(int i, int i2, Intent intent) {
    }

    public int onKeyDown(int i, KeyEvent keyEvent) {
        return -1;
    }

    public void dailyReport(String str) {
        dailyReport(str, "");
    }

    public void dailyReport(String str, String str2) {
        dailyReport("thirdapi", str, str2);
    }

    protected void dailyReport(String str, String str2, String str3) {
        if (dgr.ˋ().ॱ(str)) {
            LinkedHashMap linkedHashMap = new LinkedHashMap(3);
            linkedHashMap.put("start_type", str);
            linkedHashMap.put("service_type", Integer.valueOf(dgm.ˎ(this.callback.ˊ())));
            if (str2 != null) {
                linkedHashMap.put("third_id", str2);
            }
            dgh.ˋ("action_start_by_type", linkedHashMap);
            if (dok.ͺ()) {
                cvt o_dgt = new dgt(str + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + dgm.ˎ(this.callback.ˊ()) + (str2 == null ? "" : HiAnalyticsConstant.REPORT_VAL_SEPARATOR + str2));
                o_dgt.ˊ(str3);
                o_dgt.ॱ(str2);
                o_dgt.ˋ(this.callback.ˏ());
                cfw.ˎ(o_dgt, new dgo(TAG));
            }
        }
    }

    public String getPermission() {
        return "";
    }
}
